//群表
// 1.引入mongoose模块
const mongoose = require('mongoose');
const {static} = require('../config/config')
const GroupSchema = new mongoose.Schema({
    // 群主id
    userId: {
        type: mongoose.Schema.Types.ObjectId,
        ref: 'User'
    },

    //群名
    name: {
        type: String
    },

    //群封面
    cover: {
        type: String,
        default: static+'group.svg'
    },

    // 群公告
    notice: {
        type: String,
        default:" "
    },

    // 群建立时间
    time: {
        type: Date,
        default: new Date()
    },

})


// 3.根据规则创建集合
const Group = mongoose.model('Group', GroupSchema);


// 4.将集合做为模块成员进行导出
module.exports = Group
